<extend name="./Common/View/Public/form.html"/>
<block name="page_title">角色授权</block>
<block name="main">
    <form class="layui-form" method="post" action="sys/role/menu" lay-filter="pageForm">
        <input type="hidden" name="id" value="{$id}">
        <input type="hidden" name="menu" id="menu" value="">

        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label"></label>
            <div class="layui-input-block">
                <table class="layui-table">
                    <colgroup>
                        <col width="150">
                        <col width="200">
                        <col>
                    </colgroup>
                    <thead>
                    <tr>
                        <th>应用（模块）</th>
                        <th>分组</th>
                        <th>菜单</th>
                    </tr>
                    </thead>
                    <tbody>
                    <volist name="appList" id="app">
                        <tr>
                            <td rowspan="{$app.span}">{$app.title}</td>
                            <td>
                                <label><input lay-ignore class="ctrAll" type="checkbox" names="menu0" name="module[]"
                                              value="0">默认
                                </label></td>
                            <td>
                                <volist name="app.menu" id="m">
                                    <label><input lay-ignore type="checkbox" names="menu0" name="menu[]"
                                                  value="{$m.id}" title="{$m.title}" <if condition="in_array($m['id'],$menus)">checked</if> > {$m.title}</label>
                                </volist>
                            </td>
                        </tr>
                        <volist name="app.module" id="module">
                            <tr>
                                <td>
                                    <label><input lay-ignore type="checkbox" class="ctrAll" names="menu{$module.id}"
                                                  name="module[]" value="{$m.id}" title="{$m.title}">
                                        {$module.title}</label></td>
                                <td>
                                    <volist name="module.menu" id="m">
                                        <label>
                                            <input lay-ignore type="checkbox" names="menu{$module.id}" name="menu[]"
                                                   value="{$m.id}" title="{$m.title}" <if condition="in_array($m['id'],$menus)">checked</if> > {$m.title}</label>
                                    </volist>
                                </td>
                            </tr>
                        </volist>
                    </volist>
                    </tbody>
                </table>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="pageForm">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>
</block>